import Vue from 'vue'
import VueRouter from 'vue-router'
import layout from '../components/layout/index'
import {stringifyQuery, parseQuery} from "./utils/query";
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import routesL from './routPages'; // 页面文件目录

Vue.use(mavonEditor)
Vue.use(VueRouter)
const routes = [
    {
        path: '/',
        component: layout,
        redirect: 'home',
        children: [
            {
                name: 'home',
                path: 'home',
                component: () => import('../views/home.vue'),
            },
            {
                name: 'about',
                path: 'about',
                component: () => import('../views/about.vue'),
            },
            ...routesL,
        ]
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    stringifyQuery: stringifyQuery,
    parseQuery: parseQuery,
    routes
})

router.beforeEach((to, from, next) => {
    next();
})
export default router
